﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraFollow : MonoBehaviour {

	public Transform Mouse;
	private float disX = 0;
	// Use this for initialization
	void Start () {
		disX=transform.position.x-Mouse.position.x;
	}
	
	// Update is called once per frame
	void Update () {
		
	}

	private void LateUpdate()//相机
	{
		//让摄像机x(水平)坐标一直跟着老鼠
		float x=Mouse.position.x;
		//float x=Mouse.transform.position.y;如果上面定义GameObjexts
		transform.position = new Vector3(
			x+disX,
			transform.position.y,
			transform.position.z);
	}
}
